/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fwannotations.framework;

import fwannotations.framework.annotations.controller.Control;
import control.ControlConfig;
import fwannotations.ConstantAnnotation;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Carlangas
 */
public class AnnotationManagerV2 {

    private static List<Class> listAnn;
    private static AnnotationManagerV2 amv;

    public static AnnotationManagerV2 getInstance() {
        if (amv == null) {
            return amv = new AnnotationManagerV2();
        }
        return amv;

    }

    public static void addManagerdAnnotation(Class type) {
        if (listAnn == null) {
            listAnn = new ArrayList();
        }
        listAnn.add(type);
    }

    public static List<Class> getClassesAnnotation() {
        return listAnn;
    }

    public static void getControlConfig() {
        for (Class claseAnotada : listAnn) {
            Annotation[] annotations = claseAnotada.getAnnotations();
            for (int i = 0; i < annotations.length; i++) {
                Annotation annotation = (Annotation) annotations[i];
                if(annotation.annotationType().getName().equals(ConstantAnnotation.ANNOTATION_TYPE_CONTROL)){
                    System.out.println("" + annotation.annotationType().getName());
                    Control control=(Control)annotation;

                    ControlConfig config=new ControlConfig();
                    config.setControllerName(control.controllerName());
                    config.setNameView(control.nameView());
                    config.setPath(control.path());
                    System.out.println("-->"+control.controllerName());
                    System.out.println("-->"+control.nameView());
                    System.out.println("-->"+control.path());
                 
                   

                }
                

            }

        }



    }
}
